package org.gesplan.entity;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author David
 */
@Entity
@Table(name = "barris")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Barris.findAll", query = "SELECT b FROM Barris b"),
    @NamedQuery(name = "Barris.findByGid", query = "SELECT b FROM Barris b WHERE b.gid = :gid"),
    @NamedQuery(name = "Barris.findByCodi", query = "SELECT b FROM Barris b WHERE b.codi = :codi"),
    @NamedQuery(name = "Barris.findByNomBarri", query = "SELECT b FROM Barris b WHERE b.nomBarri = :nomBarri"),
    @NamedQuery(name = "Barris.findByAreaM2", query = "SELECT b FROM Barris b WHERE b.areaM2 = :areaM2"),
    @NamedQuery(name = "Barris.findByAreaHa", query = "SELECT b FROM Barris b WHERE b.areaHa = :areaHa")})
public class Barris implements Serializable {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @Column(name = "gid")
    private int gid;
    @Id
    @Basic(optional = false)
    @Column(name = "codi")
    private String codi;
    @Column(name = "nom_barri")
    private String nomBarri;
    @Column(name = "area_m2")
    private Integer areaM2;
    @Column(name = "area_ha")
    private Double areaHa;


    public Barris() { }


    public Barris(String codi) {
        this.codi = codi;
    }


    public int getGid() {
        return gid;
    }


    public String getCodi() {
        return codi;
    }


    public String getNomBarri() {
        return nomBarri;
    }


    public Integer getAreaM2() {
        return areaM2;
    }


    public Double getAreaHa() {
        return areaHa;
    }


    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codi != null ? codi.hashCode() : 0);
        return hash;
    }


    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Barris)) {
            return false;
        }
        Barris other = (Barris) object;
        return (this.codi != null || other.codi == null) && (this.codi == null || this.codi.equals(other.codi));
    }


    @Override
    public String toString() {
        return nomBarri;
    }
    
    
}